﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;

using Model.TrainModelHelper;

namespace DAL.TrainDALhelp
{
   public  class TrainMethodDAL
    {
        private static string ConStr = ConfigurationManager.ConnectionStrings["ConStr"].ToString();
        private static SqlConnection conn = new SqlConnection(ConStr);
        public List<TrainMethodModel> TrainMethoList()
        {
            conn.Open();
            SqlCommand comd = new SqlCommand("select * from  TrainMethodTable", conn);
            SqlDataReader read = comd.ExecuteReader();
            List<TrainMethodModel> lis = new List<TrainMethodModel>();
            while (read.Read())
            {
                TrainMethodModel str = new TrainMethodModel();

                str.TrainMethod_Id = Convert.ToInt32(read["TrainMethod_Id"]);
                str.TrainMethod_Name = read["TrainMethod_Name"].ToString();








                lis.Add(str);


            }
            read.Close();
            conn.Close();
            return lis;

        }
    }
}
